import { createRouter, createWebHistory } from 'vue-router'
import LoginPage from '@/views/login/index.vue'
import LayoutPage from '@/layout/index.vue'


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      name: 'login',
      component: LoginPage,
    },
    {
      path: '/',
      component: LayoutPage,
      redirect: 'home', // 将根路径重定向到 /home
      children: [
        {
          path: 'home',
          name: 'Home',
          component: () => import('@/views/home/index.vue'),
        },
        {
          path: 'vap',
          name: 'vap',
          component: () => import('@/views/vap/index.vue'),
        },
        {
          path: 'devTool',
          name: 'devTool',
          component: () => import('@/views/devTool/index.vue'),
        },
        {
          path: 'rtc',
          name: 'rtc',
          component: () => import('@/views/rtc/index.vue'),
        },
        {
          path: '/archive/home',
          name: 'ArchiveHome',
          component: () => import('@/views/archive/home/index.vue'),
        },
        {
          path: '/secret/home',
          name: 'SecretHome',
          component: () => import('@/views/secret/home/index.vue'),
        },
        {
          path: '/secret/book',
          name: 'SecretBook',
          component: () => import('@/views/secret/show/index.vue'),
        },
        {
          path: '/idp/home',
          name: 'IdpHome',
          component: () => import('@/views/idp/home/index.vue'),
        },
        {
          path: '/:pathMatch(.*)',
          name: "error",
          component: () => import('@/views/error/index.vue')
        },
      ]
    },
  ],
})


export default router
